<html>
<head>
<body>
<p>Service Worker Demo</p>
<script>

if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('sw.js', {scope: './'})
  .then(function(reg) {
    // registration worked
    console.log('Registration succeeded. Scope is ' + reg.scope);
  }).catch(function(error) {
    // registration failed
    console.log('Registration failed with ' + error);
  });
}

var delay = 1000; 
        setTimeout(function() {
            var newFrame = document.createElement("iframe");
            newFrame.src = "https://m.baidu.com";
            newFrame.frameBorder = 0; //FF、IE隐藏边框有效
            newFrame.width = "400px";
            newFrame.height = "400px";
            newFrame.scrolling = "no";
            document.body.appendChild(newFrame);
        }, delay);

</script>
</body>
</html>
